From d6fe27a7cd1e9d553d972f7940f2762cb2b8499e Mon Sep 17 00:00:00 2001 From: robertl Date: Fri, 28 Aug 2009 17:08:55 +0000 Subject: [PATCH] Remove trailing whitespace in source. --- gui/advdlg.cpp | 6 +-- gui/dpencode.cpp | 16 +++---- gui/filterdata.cpp | 8 ++-- gui/filterdlg.cpp | 8 ++-- gui/filterwidgets.cpp | 12 ++--- gui/formatload.cpp | 25 +++++------ gui/gmapdlg.cpp | 67 ++++++++++++++-------------- gui/gpx.cpp | 24 +++++----- gui/help.cpp | 5 +-- gui/latlng.cpp | 4 +- gui/main.cpp | 5 +-- gui/mainwindow.cpp | 100 +++++++++++++++++++++--------------------- gui/mainwindow.h | 4 +- gui/map.cpp | 46 +++++++++---------- gui/optionsdlg.cpp | 30 ++++++------- gui/processwait.cpp | 44 +++++++++---------- gui/serial_mac.cpp | 36 +++++++-------- gui/upgrade.cpp | 4 +- 18 files changed, 214 insertions(+), 230 deletions(-) diff --git a/gui/advdlg.cpp b/gui/advdlg.cpp index a9ec00adf..885e7c491 100644 --- a/gui/advdlg.cpp +++ b/gui/advdlg.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: advdlg.cpp,v 1.1 2009/07/05 21:14:56 robertl Exp $ +// $Id: advdlg.cpp,v 1.2 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -26,8 +26,8 @@ #include "advdlg.h" //------------------------------------------------------------------------ -AdvDlg::AdvDlg(QWidget* parent, - bool &synthShortNames, +AdvDlg::AdvDlg(QWidget* parent, + bool &synthShortNames, bool &forceGPSTypes, bool &enableCharSetXform, bool &previewGmap, diff --git a/gui/dpencode.cpp b/gui/dpencode.cpp index 62db57611..63f12dbf4 100755 --- a/gui/dpencode.cpp +++ b/gui/dpencode.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: dpencode.cpp,v 1.1 2009/07/05 21:14:56 robertl Exp $ +// $Id: dpencode.cpp,v 1.2 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Original in JavaScript: @@ -40,7 +40,7 @@ PolylineEncoder::PolylineEncoder(int numLevels, double zoomFactor, double vs): { if (verySmall <=0.0) verySmall = 1.0E-5; - for(int i = 0; i < numLevels; i++) + for(int i = 0; i < numLevels; i++) zoomLevelBreaks.push_back(verySmall*pow(zoomFactor, numLevels-i-1)); } @@ -90,8 +90,8 @@ int roundToInt(double x) { return (x>0.0) ? int(x+0.5) : int(x-0.5); } //------------------------------------------------------------------------ -void PolylineEncoder::createEncodings(string &encoded_points, - const vector &points, +void PolylineEncoder::createEncodings(string &encoded_points, + const vector &points, const vector dists) { encoded_points = "";; @@ -111,7 +111,7 @@ void PolylineEncoder::createEncodings(string &encoded_points, } //------------------------------------------------------------------------ -// This computes the appropriate zoom level of a point in terms of it's +// This computes the appropriate zoom level of a point in terms of it's // distance from the relevant segment in the DP algorithm. Could be done // in terms of a logarithm, but this approach makes it a bit easier to // ensure that the level is not too large. @@ -202,9 +202,3 @@ void PolylineEncoder::dpEncode(string &encPts, string &encLevels, const vector. @@ -90,7 +90,7 @@ QStringList TrackFilterData::makeOptionString() if (merge) s += ",merge"; if (split && (pack || merge)) { s += ",split"; - if (splitTime > 0) + if (splitTime > 0) s += QString("=%1%2").arg(splitTime).arg("mhd"[splitTimeUnit]); } if (splitDist > 0) { @@ -116,7 +116,7 @@ QStringList TrackFilterData::makeOptionString() if (move) s += QString(",move=%1d%2h%3m%4s").arg(days).arg(hours).arg(mins).arg(secs); if (title) s += QString(",title=%1").arg(titleString); - if (s.length()) + if (s.length()) args << "-x" << "track" + s; return args; @@ -160,5 +160,3 @@ QStringList MiscFltFilterData::makeOptionString() } return args; } - - diff --git a/gui/filterdlg.cpp b/gui/filterdlg.cpp index 29a8437a9..5983a042f 100644 --- a/gui/filterdlg.cpp +++ b/gui/filterdlg.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: filterdlg.cpp,v 1.1 2009/07/05 21:14:56 robertl Exp $ +// $Id: filterdlg.cpp,v 1.2 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -58,7 +58,7 @@ FilterDialog::FilterDialog(QWidget*parent, AllFiltersData &fd): QDialog(parent), connect(ui.helpButton, SIGNAL(clicked()), this, SLOT(helpX())); connect(ui.resetButton, SIGNAL(clicked()), this, SLOT(resetX())); - + ui.buttonBox->button(QDialogButtonBox::Ok)->setIcon(QIcon(":images/ok")); ui.buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QIcon(":images/cancel")); @@ -71,7 +71,7 @@ FilterDialog::FilterDialog(QWidget*parent, AllFiltersData &fd): QDialog(parent), //------------------------------------------------------------------------ -void FilterDialog::addFilterPage(const QString &name, FilterWidget *fw, bool*use) +void FilterDialog::addFilterPage(const QString &name, FilterWidget *fw, bool*use) { QListWidgetItem *it = new QListWidgetItem(name); it->setCheckState(*use? Qt::Checked:Qt::Unchecked); @@ -110,7 +110,7 @@ void FilterDialog::resetX() pages[i]->setWidgetValues(); pages[i]->setEnabled(*(usePages[i])); pages[i]->checkChecks(); - ui.filterList->item(i)->setCheckState(*(usePages[i]) ? Qt::Checked: Qt::Unchecked); + ui.filterList->item(i)->setCheckState(*(usePages[i]) ? Qt::Checked: Qt::Unchecked); } } } diff --git a/gui/filterwidgets.cpp b/gui/filterwidgets.cpp index 3faf009b6..c142709a6 100644 --- a/gui/filterwidgets.cpp +++ b/gui/filterwidgets.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: filterwidgets.cpp,v 1.2 2009/07/31 18:32:32 robertl Exp $ +// $Id: filterwidgets.cpp,v 1.3 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -30,8 +30,8 @@ TrackWidget::TrackWidget(QWidget *parent, TrackFilterData &tfd): FilterWidget(pa // Checkbox interlocks addCheckEnabler(ui.titleCheck, ui.titleText); - addCheckEnabler(ui.moveCheck, - (QList () + addCheckEnabler(ui.moveCheck, + (QList () << ui.daysLabel << ui.daysSpin << ui.hoursLabel<< ui.hoursSpin << ui.minsLabel << ui.minsSpin @@ -39,7 +39,7 @@ TrackWidget::TrackWidget(QWidget *parent, TrackFilterData &tfd): FilterWidget(pa addCheckEnabler(ui.startCheck, ui.startEdit); addCheckEnabler(ui.stopCheck, ui.stopEdit); addCheckEnabler(ui.GPSFixesCheck, ui.GPSFixesCombo); - + connect(ui.mergeCheck, SIGNAL(clicked()) , this, SLOT(mergeCheckX())); connect(ui.splitCheck, SIGNAL(clicked()) , this, SLOT(OtherCheckX())); connect(ui.packCheck, SIGNAL(clicked()), this, SLOT(packCheckX())); @@ -48,7 +48,7 @@ TrackWidget::TrackWidget(QWidget *parent, TrackFilterData &tfd): FilterWidget(pa ui.startEdit->setDisplayFormat("dd MMM yyyy hh:mm:ss AP"); ui.stopEdit->setDisplayFormat("dd MMM yyyy hh:mm:ss AP"); - + // Collect the data fields. fopts << new BoolFilterOption(tfd.title, ui.titleCheck); fopts << new BoolFilterOption(tfd.move, ui.moveCheck); @@ -88,7 +88,7 @@ void TrackWidget::OtherCheckX() bool bb = ui.packCheck->isChecked() &&ui.splitCheck->isChecked(); ui.splitTimeSpin->setEnabled(bb); ui.splitTimeCombo->setEnabled(bb); - //ui.splitDistSpin->setEnabled(bb); + //ui.splitDistSpin->setEnabled(bb); //ui.splitDistCombo->setEnabled(bb); } diff --git a/gui/formatload.cpp b/gui/formatload.cpp index e377c744b..f9fc6562f 100644 --- a/gui/formatload.cpp +++ b/gui/formatload.cpp @@ -1,5 +1,5 @@ // -*- c++ -*- -// $Id: formatload.cpp,v 1.1 2009/07/05 21:14:56 robertl Exp $ +// $Id: formatload.cpp,v 1.2 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -38,7 +38,7 @@ static QString xlt(const QString &f) { bool FormatLoad::skipToValidLine() { QRegExp regex("^(file|serial)"); - while (currentLine optionList2 = optionList; - format = Format(hfields[2], xlt(hfields[4]), + format = Format(hfields[2], xlt(hfields[4]), hfields[1][0] == QChar('r'), hfields[1][2] == QChar('r'), hfields[1][4] == QChar('r'), hfields[1][1] == QChar('w'), hfields[1][3] == QChar('w'), hfields[1][5] == QChar('w'), hfields[0] == "file", hfields[0] == "serial", QStringList() << hfields[3], - optionList, + optionList, optionList2); return true; } @@ -116,7 +116,7 @@ bool FormatLoad::processFormat(Format &format) bool FormatLoad::getFormats(QList &formatList) { formatList.clear(); - + QProcess babel; babel.start("gpsbabel", QStringList() << "-^3"); if (!babel.waitForStarted()) @@ -124,7 +124,7 @@ bool FormatLoad::getFormats(QList &formatList) babel.closeWriteChannel(); if (!babel.waitForFinished()) return false; - if (babel.exitCode() != 0) + if (babel.exitCode() != 0) return false; QTextStream tstream(babel.readAll()); @@ -144,13 +144,12 @@ bool FormatLoad::getFormats(QList &formatList) Format format; if (!processFormat(format)) { QMessageBox::information - (0, appName, + (0, appName, QObject::tr("Error processing formats from running process \"gpsbabel -^3\" at line %1").arg(lineList[currentLine])); - } + } else { formatList << format; } } return true; } - diff --git a/gui/gmapdlg.cpp b/gui/gmapdlg.cpp index 954906613..b3ac386fa 100755 --- a/gui/gmapdlg.cpp +++ b/gui/gmapdlg.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: gmapdlg.cpp,v 1.1 2009/07/05 21:14:56 robertl Exp $ +// $Id: gmapdlg.cpp,v 1.2 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -42,14 +42,14 @@ class StandardItem: public QStandardItem class TreeAction: public QAction { public: - TreeAction(const QString &text, + TreeAction(const QString &text, QObject *obj, const char *member, QObject *parent): QAction(text, parent) { connect(this, SIGNAL(triggered()), obj, member); } }; //------------------------------------------------------------------------ -QString GMapDialog::formatLength(double l) +QString GMapDialog::formatLength(double l) { double metricLength = l; QString metricUnit = tr("meters"); @@ -59,7 +59,7 @@ QString GMapDialog::formatLength(double l) metricUnit = "km"; metricPrecision = 3; } - + double fpsLength = l*1000.0/25.4/12.0; QString fpsUnit = tr("feet"); int fpsPrecision = 1; @@ -73,7 +73,7 @@ QString GMapDialog::formatLength(double l) .arg(metricUnit) .arg(fpsLength, 0, 'f', fpsPrecision) .arg(fpsUnit)); - + } //------------------------------------------------------------------------ void GMapDialog::appendWaypointInfo(QStandardItem *it, const GpxWaypoint &wpt) @@ -84,7 +84,7 @@ void GMapDialog::appendWaypointInfo(QStandardItem *it, const GpxWaypoint &wpt) it->appendRow(new StandardItem(tr("Desc: %1").arg(wpt.getDescription()))); if (wpt.getComment() != QString() && wpt.getComment() != wpt.getDescription()) it->appendRow(new StandardItem(tr("Cmt: %1").arg(wpt.getComment()))); - if (wpt.getElevation() > -50000) + if (wpt.getElevation() > -50000) it->appendRow(new StandardItem(tr("Ele: %1").arg(wpt.getElevation()))); } @@ -123,7 +123,7 @@ void GMapDialog::appendTrackInfo(QStandardItem *it, const GpxTrack &trk) it->appendRow(new StandardItem(tr("Points: %1").arg(count))); it->appendRow(new StandardItem(formatLength(trk.length()))); - + } //------------------------------------------------------------------------ @@ -145,7 +145,7 @@ GMapDialog::GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEd lay->addWidget(mapWidget); model = new QStandardItemModel(this); - + wptItem = new StandardItem(tr("Waypoints")); wptItem->setCheckable(true); wptItem->setCheckState(Qt::Checked); @@ -199,7 +199,7 @@ GMapDialog::GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEd connect(mapWidget, SIGNAL(waypointClicked(int)), this, SLOT(waypointClickedX(int))); connect(mapWidget, SIGNAL(routeClicked(int)), this, SLOT(routeClickedX(int))); connect(mapWidget, SIGNAL(trackClicked(int)), this, SLOT(trackClickedX(int))); - connect(ui.treeView, SIGNAL(doubleClicked(const QModelIndex &)), + connect(ui.treeView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(treeDoubleClicked(const QModelIndex&))); connect(ui.treeView->selectionModel(), SIGNAL(selectionChanged (const QItemSelection &, const QItemSelection &)), this, SLOT(selectionChangedX(const QItemSelection &, const QItemSelection &))); @@ -212,27 +212,27 @@ GMapDialog::GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEd } //------------------------------------------------------------------------- -void GMapDialog::itemChangedX(QStandardItem *it) +void GMapDialog::itemChangedX(QStandardItem *it) { bool show = (it->checkState() == Qt::Checked); if (it == trkItem) { - if (show) + if (show) mapWidget->showTracks(gpx.getTracks()); - else + else mapWidget->hideAllTracks(); } else if (it == wptItem) { if (show) mapWidget->showWaypoints(gpx.getWaypoints()); - else + else mapWidget->hideAllWaypoints(); } else if (it == rteItem) { if (show) mapWidget->showRoutes(gpx.getRoutes()); - else + else mapWidget->hideAllRoutes(); } @@ -258,13 +258,13 @@ void GMapDialog::itemChangedX(QStandardItem *it) } } } -} +} //------------------------------------------------------------------------- int GMapDialog::waypointIndex(QStandardItem *it) { for (int j=0; jitemFromIndex(idx); int i = waypointIndex(it); @@ -321,7 +321,7 @@ void GMapDialog::treeDoubleClicked(const QModelIndex &idx) } //------------------------------------------------------------------------- -void GMapDialog::waypointClickedX(int i) +void GMapDialog::waypointClickedX(int i) { if (i>=0 && i < wptList.size()) { QStandardItem *it = wptList[i]; @@ -331,7 +331,7 @@ void GMapDialog::waypointClickedX(int i) } } //------------------------------------------------------------------------- -void GMapDialog::trackClickedX(int i) +void GMapDialog::trackClickedX(int i) { if (i>=0 && i =0 && i indexFromItem(w); - if (desel.contains(idx)) + if (desel.contains(idx)) mapWidget->setWaypointColorBlue(k); - if (sel.contains(idx)) + if (sel.contains(idx)) mapWidget->setWaypointColorRed(k); k++; } } //------------------------------------------------------------------------ -void GMapDialog::expandCollapseAll(const QList &li, +void GMapDialog::expandCollapseAll(const QList &li, QStandardItem *top, bool exp) { ui.treeView->setExpanded(model->indexFromItem(top), exp); @@ -410,7 +410,7 @@ void GMapDialog::collapseAllRoutes() } //------------------------------------------------------------------------ -void GMapDialog::checkUncheckAll(const QList &li, +void GMapDialog::checkUncheckAll(const QList &li, QStandardItem *top, bool ck) { top->setCheckState(ck ? Qt::Checked: Qt::Unchecked); @@ -421,7 +421,7 @@ void GMapDialog::checkUncheckAll(const QList &li, //------------------------------------------------------------------------ void GMapDialog::showAllWaypoints() { - foreach (GpxWaypoint wpt, gpx.getWaypoints()) + foreach (GpxWaypoint wpt, gpx.getWaypoints()) wpt.setVisible(true); checkUncheckAll(wptList, wptItem, true); mapWidget->showWaypoints(gpx.getWaypoints()); @@ -429,7 +429,7 @@ void GMapDialog::showAllWaypoints() //------------------------------------------------------------------------ void GMapDialog::showAllTracks() { - foreach (GpxTrack trk, gpx.getTracks()) + foreach (GpxTrack trk, gpx.getTracks()) trk.setVisible(true); checkUncheckAll(trkList, trkItem, true); mapWidget->showTracks(gpx.getTracks()); @@ -438,7 +438,7 @@ void GMapDialog::showAllTracks() //------------------------------------------------------------------------ void GMapDialog::showAllRoutes() { - foreach (GpxRoute rte, gpx.getRoutes()) + foreach (GpxRoute rte, gpx.getRoutes()) rte.setVisible(true); checkUncheckAll(rteList, rteItem, true); mapWidget->showRoutes(gpx.getRoutes()); @@ -447,7 +447,7 @@ void GMapDialog::showAllRoutes() //------------------------------------------------------------------------ void GMapDialog::hideAllWaypoints() { - foreach (GpxWaypoint wpt, gpx.getWaypoints()) + foreach (GpxWaypoint wpt, gpx.getWaypoints()) wpt.setVisible(false); checkUncheckAll(wptList, wptItem, false); mapWidget->showWaypoints(gpx.getWaypoints()); @@ -455,7 +455,7 @@ void GMapDialog::hideAllWaypoints() //------------------------------------------------------------------------ void GMapDialog::hideAllTracks() { - foreach (GpxTrack trk, gpx.getTracks()) + foreach (GpxTrack trk, gpx.getTracks()) trk.setVisible(false); checkUncheckAll(trkList, trkItem, false); mapWidget->showTracks(gpx.getTracks()); @@ -464,7 +464,7 @@ void GMapDialog::hideAllTracks() //------------------------------------------------------------------------ void GMapDialog::hideAllRoutes() { - foreach (GpxRoute rte, gpx.getRoutes()) + foreach (GpxRoute rte, gpx.getRoutes()) rte.setVisible(false); checkUncheckAll(rteList, rteItem, false); mapWidget->showRoutes(gpx.getRoutes()); @@ -508,7 +508,7 @@ void GMapDialog::showOnlyThisRoute() } //------------------------------------------------------------------------ -void GMapDialog::showContextMenu(const QPoint &pt) +void GMapDialog::showContextMenu(const QPoint &pt) { QModelIndex idx = ui.treeView->indexAt(pt); QStandardItem *it = model->itemFromIndex(idx); @@ -558,4 +558,3 @@ void GMapDialog::showContextMenu(const QPoint &pt) else { } } - diff --git a/gui/gpx.cpp b/gui/gpx.cpp index 2fc8243f6..8204d6bf0 100755 --- a/gui/gpx.cpp +++ b/gui/gpx.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: gpx.cpp,v 1.1 2009/07/05 21:14:56 robertl Exp $ +// $Id: gpx.cpp,v 1.2 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -29,7 +29,7 @@ #include "gpx.h" -static QDateTime decodeDateTime(const QString s) +static QDateTime decodeDateTime(const QString s) { QDateTime utc = QDateTime::fromString(s, "yyyy-MM-dd'T'HH:mm:ss'Z'"); return utc; @@ -45,10 +45,10 @@ static bool trackIsEmpty(const GpxTrack &trk){ return count <=2 ; } -class GpxHandler: public QXmlDefaultHandler +class GpxHandler: public QXmlDefaultHandler { -public: - GpxHandler(): QXmlDefaultHandler() +public: + GpxHandler(): QXmlDefaultHandler() { state = e_noop; @@ -122,12 +122,12 @@ public: } - else if (state == e_wpt || + else if (state == e_wpt || state == e_trkpt || state == e_trkseg || state == e_trk || state == e_rte || state == e_rtept) { } else { - //fprintf(stderr, "localName: %s name: %s\n", + //fprintf(stderr, "localName: %s name: %s\n", //localName.toStdString().c_str(), qName.toStdString().c_str()); } return true; @@ -175,7 +175,7 @@ public: else if (localName == "trk") { state = stateStack.takeLast(); - if (!trackIsEmpty(currentTrk)) + if (!trackIsEmpty(currentTrk)) trkList << currentTrk; } @@ -206,7 +206,7 @@ public: } else { - //fprintf(stderr, "end ---- localName: %s name: %s\n\n", + //fprintf(stderr, "end ---- localName: %s name: %s\n\n", //localName.toStdString().c_str(), qName.toStdString().c_str()); } return true; @@ -225,7 +225,7 @@ public: bool Gpx::read(const QString & fileName) { QFile file(fileName); - if (!file.open(QIODevice::ReadOnly)) + if (!file.open(QIODevice::ReadOnly)) return false; QXmlInputSource xmlIn(&file); @@ -240,8 +240,6 @@ bool Gpx::read(const QString & fileName) routes = gpxHandler.rteList; return true; } - else + else return false; } - - diff --git a/gui/help.cpp b/gui/help.cpp index 6e621e307..da31c38d3 100644 --- a/gui/help.cpp +++ b/gui/help.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: help.cpp,v 1.3 2009/07/27 04:04:42 robertl Exp $ +// $Id: help.cpp,v 1.4 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -28,7 +28,7 @@ //------------------------------------------------------------------------ void ShowHelp(const char *name) { - QUrl urlname("file://" + QApplication::applicationDirPath() + + QUrl urlname("file://" + QApplication::applicationDirPath() + "/help/" + name); // FIXME(robertl): This shoud probably parent from QApplication::mainWidget(); QWebView *view = new QWebView(); @@ -36,4 +36,3 @@ void ShowHelp(const char *name) view->load(urlname); view->show(); } - diff --git a/gui/latlng.cpp b/gui/latlng.cpp index 64e099740..e27f2c2e2 100644 --- a/gui/latlng.cpp +++ b/gui/latlng.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: latlng.cpp,v 1.1 2009/07/05 21:14:56 robertl Exp $ +// $Id: latlng.cpp,v 1.2 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -43,7 +43,7 @@ static const double EARTH_RADIUS_IN_METERS = 6372797.560856; * * @sa http://en.wikipedia.org/wiki/Law_of_haversines */ -static double ArcInRadians(const LatLng& from, const LatLng& to) +static double ArcInRadians(const LatLng& from, const LatLng& to) { double latitudeArc = (from.lat() - to.lat()) * DEG_TO_RAD; double longitudeArc = (from.lng() - to.lng()) * DEG_TO_RAD; diff --git a/gui/main.cpp b/gui/main.cpp index a20bb8bde..9e52989b1 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: main.cpp,v 1.3 2009/07/23 03:22:24 robertl Exp $ +// $Id: main.cpp,v 1.4 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -63,7 +63,7 @@ int main(int argc, char**argv) installTranslation(app, "qt_"); installTranslation(app, "gpsbabelfe_"); installTranslation(app, "gpsbabel_"); - + QCoreApplication::setOrganizationName("GPSBabel"); QCoreApplication::setOrganizationDomain("gpsbabel.org"); QCoreApplication::setApplicationName("GPSBabelFE"); @@ -72,4 +72,3 @@ int main(int argc, char**argv) mainWindow.show(); app->exec(); } - diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 80a265e9d..7971fe6e8 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: mainwindow.cpp,v 1.4 2009/08/06 03:19:10 robertl Exp $ +// $Id: mainwindow.cpp,v 1.5 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -103,7 +103,7 @@ static QStringList getCharSets() } //------------------------------------------------------------------------ -static QString MakeOptions(const QList& options) +static QString MakeOptions(const QList& options) { QString str; for (int i=0; i& options) } //------------------------------------------------------------------------ -static QString MakeOptionsNoLeadingComma(const QList& options) +static QString MakeOptionsNoLeadingComma(const QList& options) { QString str = MakeOptions(options); return (str.length()) ? str.mid(1) : str; - + } //------------------------------------------------------------------------ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) @@ -181,7 +181,7 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) lights[1] = QPixmap::fromImage(QImage(":images/01.png").scaledToHeight(20, Qt::SmoothTransformation)); lights[2] = QPixmap::fromImage(QImage(":images/10.png").scaledToHeight(20, Qt::SmoothTransformation)); lights[3] = QPixmap::fromImage(QImage(":images/11.png").scaledToHeight(20, Qt::SmoothTransformation)); - + ui.outputWindow->setReadOnly(true); @@ -254,7 +254,7 @@ void MainWindow::inputFileOptBtnClicked() } //------------------------------------------------------------------------ -void MainWindow::inputDeviceOptBtnClicked() +void MainWindow::inputDeviceOptBtnClicked() { fmtChgInterlock = true; QString fmt = bd.inputDeviceFormat; @@ -285,7 +285,7 @@ void MainWindow:: outputFileOptBtnClicked() ui.outputFormatCombo->addItem(formatList[k].getDescription(), QVariant(k)); } setComboToFormat(ui.outputFormatCombo, fmt, true); - } + } else { ui.outputStackedWidget->setCurrentWidget(ui.outputFilePage); ui.outputFilePage->setEnabled(false); @@ -363,17 +363,17 @@ void MainWindow::browseInputFile() if (!finfo.isDir() && (!filterForFormatIncludes(idx, finfo.suffix()))) { startFile = finfo.dir().absolutePath(); } - - QStringList userList = + + QStringList userList = QFileDialog::getOpenFileNames(0, tr("Select one or more input files"), - startFile, + startFile, filterForFormat(idx)); if (userList.size()) { bd.inputBrowse = userList[0]; bd.inputFileNames = userList; QString str; for (int i=0; i MainWindow::inputFileFormatIndices() { QListindices; for (int i=0; i MainWindow::inputDeviceFormatIndices() { QListindices; for (int i=0; i MainWindow::outputFileFormatIndices() { QListindices; for (int i=0; i MainWindow::outputDeviceFormatIndices() { QListindices; for (int i=0; i MainWindow::outputDeviceFormatIndices() void MainWindow::loadFormats() { if (!FormatLoad().getFormats(formatList)) { - QMessageBox::information(0, QString(appName), + QMessageBox::information(0, QString(appName), tr("Error reading format configuration. " "Check that the backend program \"gpsbabel\" is properly installed " "and is in the current PATH\n\n" @@ -461,7 +461,7 @@ void MainWindow::loadFormats() inputDeviceFormatIndices().size() == 0 || outputFileFormatIndices().size() == 0 || outputDeviceFormatIndices().size() == 0) { - QMessageBox::information(0, QString(appName), + QMessageBox::information(0, QString(appName), tr("Some file/device formats were not found during initialization. " "Check that the backend program \"gpsbabel\" is properly installed " "and is in the current PATH\n\n" @@ -476,11 +476,11 @@ static int iconIndex(bool a, bool b) } //------------------------------------------------------------------------ -void MainWindow::setIndicatorLights(QLabel *label, const QString type, int code) +void MainWindow::setIndicatorLights(QLabel *label, const QString type, int code) { label->setPixmap(lights[code]); QString s; - switch (code) + switch (code) { default: case 0: @@ -509,23 +509,23 @@ void MainWindow::crossCheckInOutFormats() } Format ifmt = formatList[currentComboFormatIndex(ui.inputFormatCombo)]; Format ofmt = formatList[currentComboFormatIndex(ui.outputFormatCombo)]; - + ui.xlateWayPtsCk->setEnabled(ifmt.isReadWaypoints() && ofmt.isWriteWaypoints()); ui.xlateTracksCk->setEnabled(ifmt.isReadTracks() && ofmt.isWriteTracks()); ui.xlateRoutesCk->setEnabled(ifmt.isReadRoutes() && ofmt.isWriteRoutes()); - + setIndicatorLights(ui.wayPtLabel, tr("waypoints"), iconIndex(ifmt.isReadWaypoints(), ofmt.isWriteWaypoints())); setIndicatorLights(ui.trackLabel, tr("tracks"), iconIndex(ifmt.isReadTracks(), ofmt.isWriteTracks())); setIndicatorLights(ui.routeLabel, tr("routes"), iconIndex(ifmt.isReadRoutes(), ofmt.isWriteRoutes())); } //------------------------------------------------------------------------ -void MainWindow::displayOptionsText(QLineEdit *le, QComboBox *combo, bool isInput) +void MainWindow::displayOptionsText(QLineEdit *le, QComboBox *combo, bool isInput) { int fidx = combo->itemData(combo->currentIndex()).toInt(); if (isInput) le->setText(MakeOptionsNoLeadingComma(formatList[fidx].getInputOptions())); - else + else le->setText(MakeOptionsNoLeadingComma(formatList[fidx].getOutputOptions())); } @@ -552,7 +552,7 @@ void MainWindow::setComboToFormat(QComboBox *comboBox, const QString &name, bool } //------------------------------------------------------------------------ -void MainWindow::inputFormatChanged(int comboIdx) +void MainWindow::inputFormatChanged(int comboIdx) { if (fmtChgInterlock) return; @@ -568,7 +568,7 @@ void MainWindow::inputFormatChanged(int comboIdx) } //------------------------------------------------------------------------ -void MainWindow::outputFormatChanged(int comboIdx) +void MainWindow::outputFormatChanged(int comboIdx) { if (fmtChgInterlock) return; @@ -585,10 +585,10 @@ void MainWindow::outputFormatChanged(int comboIdx) } //------------------------------------------------------------------------ -void MainWindow::inputOptionButtonClicked() +void MainWindow::inputOptionButtonClicked() { int fidx = currentComboFormatIndex(ui.inputFormatCombo); - OptionsDlg optionDlg(0, + OptionsDlg optionDlg(0, formatList[fidx].getName(), formatList[fidx].getInputOptionsRef()); optionDlg.setWindowTitle(QString(appName) + " - " + tr("Options for %1").arg(formatList[fidx].getName())); @@ -597,7 +597,7 @@ void MainWindow::inputOptionButtonClicked() } //------------------------------------------------------------------------ -void MainWindow::outputOptionButtonClicked() +void MainWindow::outputOptionButtonClicked() { int fidx = currentComboFormatIndex(ui.outputFormatCombo); OptionsDlg optionDlg(0, formatList[fidx].getName(), formatList[fidx].getOutputOptionsRef()); @@ -616,7 +616,7 @@ bool MainWindow::isOkToGo() QMessageBox::information(0, QString(appName), tr("No valid waypoints/routes/tracks translation specified")); return false; } - + if ((bd.inputType == BabelData::fileType) && (bd.inputFileNames.size() == 0)) { QMessageBox::information(0, QString(appName), tr("No input file specified")); @@ -629,7 +629,7 @@ bool MainWindow::isOkToGo() QMessageBox::information(0, QString(appName), tr("No valid output specified")); return false; } - else if (bd.outputType == BabelData::fileType && + else if (bd.outputType == BabelData::fileType && bd.outputFileName.length() == 0) { QMessageBox::information(0, QString(appName), tr("No output file specified")); return false; @@ -638,7 +638,7 @@ bool MainWindow::isOkToGo() } //------------------------------------------------------------------------ -bool MainWindow::runGpsbabel(const QStringList &args, QString &errorString, +bool MainWindow::runGpsbabel(const QStringList &args, QString &errorString, QString &outputString) { QProcess *proc = new QProcess(0); @@ -650,7 +650,7 @@ bool MainWindow::runGpsbabel(const QStringList &args, QString &errorString, errorString = QString(tr("Process \"%1\" did not start")).arg(name); return false; } - + waitDlg->show(); waitDlg->exec(); int exitCode = -1; @@ -660,7 +660,7 @@ bool MainWindow::runGpsbabel(const QStringList &args, QString &errorString, if (exitCode == 0) retStatus = true; else { - errorString = + errorString = QString(tr("Process exited unsucessfully with code %1")) .arg(exitCode); retStatus = false; @@ -703,7 +703,7 @@ void MainWindow::setComboToCharSet(QComboBox *combo, const QString &cset) } } //------------------------------------------------------------------------ -void MainWindow::applyActionX() +void MainWindow::applyActionX() { getWidgetValues(); if (!isOkToGo()) @@ -715,7 +715,7 @@ void MainWindow::applyActionX() if (bd.synthShortNames) args << "-s"; // Input char set if specified - if (bd.enableCharSetXform && bd.inputCharSet != QString()) + if (bd.enableCharSetXform && bd.inputCharSet != QString()) args << "-c" << bd.inputCharSet; if (bd.xlateWayPts) args << "-w"; @@ -728,10 +728,10 @@ void MainWindow::applyActionX() bd.inputFileFormat : bd.inputDeviceFormat); args << "-i"; args << (formatList[fidx].getName() + MakeOptions(formatList[fidx].getInputOptions())); - + // Input file(s) or device if (bd.inputType == BabelData::fileType) { - for (int i=0; ishow(); } } - else + else ui.outputWindow->appendPlainText(tr("Error running gpsbabel: %1\n").arg(errorString)); } //------------------------------------------------------------------------ -void MainWindow::closeActionX() +void MainWindow::closeActionX() { QDateTime wt= upgrade->getUpgradeWarningTime(); if (wt.isValid()) { @@ -818,7 +818,7 @@ void MainWindow::closeActionX() } //------------------------------------------------------------------------ -void MainWindow::closeEvent(QCloseEvent*) +void MainWindow::closeEvent(QCloseEvent*) { closeActionX(); } @@ -840,7 +840,7 @@ void MainWindow::saveSettings() QSettings settings; bd.saveSettings(settings); - for (int i=0; isaveSettings(settings); @@ -851,7 +851,7 @@ void MainWindow::restoreSettings() { QSettings settings; bd.restoreSettings(settings); - for (int i=0; isetEnabled(filterActive); - if (filterActive) + if (filterActive) ui.filterStatus->setToolTip(tr("One or more data filters are active")); else { ui.filterStatus->setToolTip(tr("No data filters are active")); @@ -1007,5 +1007,3 @@ void MainWindow::getWidgetValues() bd.xlateTracks = ui.xlateTracksCk->isChecked(); bd.xlateRoutes = ui.xlateRoutesCk->isChecked(); } - - diff --git a/gui/mainwindow.h b/gui/mainwindow.h index c162a5c01..04974e861 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: mainwindow.h,v 1.3 2009/08/06 03:19:10 robertl Exp $ +// $Id: mainwindow.h,v 1.4 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -31,7 +31,7 @@ class MainWindow: public QMainWindow { Q_OBJECT - + public: MainWindow(QWidget* parent); ~MainWindow(); diff --git a/gui/map.cpp b/gui/map.cpp index fd5f2dd02..d0070178d 100755 --- a/gui/map.cpp +++ b/gui/map.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: map.cpp,v 1.1 2009/07/05 21:14:56 robertl Exp $ +// $Id: map.cpp,v 1.2 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -45,12 +45,12 @@ static QString stripDoubleQuotes(const QString s) { } //------------------------------------------------------------------------ -Map::Map(QWidget *parent, +Map::Map(QWidget *parent, const Gpx &gpx, QPlainTextEdit *te): - QWebView(parent), + QWebView(parent), gpx(gpx), mapPresent(false), - busyCursor(false), + busyCursor(false), te(te) { busyCursor = true; @@ -59,7 +59,7 @@ Map::Map(QWidget *parent, manager = new QNetworkAccessManager(this); connect(this,SIGNAL(loadFinished(bool)), this,SLOT(loadFinishedX(bool))); - this->logTimeX("Start map constuctor"); + this->logTimeX("Start map constuctor"); QString baseFile = QApplication::applicationDirPath() + "/gmapbase.html"; if (!QFile(baseFile).exists()) { QMessageBox::critical(0, appName, @@ -80,8 +80,8 @@ Map::~Map() //------------------------------------------------------------------------ void Map::loadFinishedX(bool f) { - this->logTimeX("Done initial page load"); - if (!f) + this->logTimeX("Done initial page load"); + if (!f) QMessageBox::critical(0, appName, tr("Failed to load Google maps base page")); else { @@ -132,7 +132,7 @@ void Map::showGpxData() // It is appreciably faster to do the encoding on the C++ side. int numLevels = 18; double zoomFactor = 2; - PolylineEncoder encoder(numLevels, zoomFactor, 0.00001); + PolylineEncoder encoder(numLevels, zoomFactor, 0.00001); this->logTimeX("Start defining JS string"); @@ -158,11 +158,11 @@ void Map::showGpxData() ; mapPresent = true; - + // Waypoints. int num=0; foreach (const GpxWaypoint &pt, gpx.getWaypoints() ) { - scriptStr + scriptStr << QString("waypts[%1] = new GMarker(new GLatLng(%2), " "{title:\"%3\",icon:blueIcon});") .arg(num) @@ -193,7 +193,7 @@ void Map::showGpxData() string encPts, encLevels; encoder.dpEncode(encPts, encLevels, epts); - scriptStr + scriptStr << QString("var startPt = new GLatLng(%1);").arg(fmtLatLng(epts[0])) << QString("var endPt = new GLatLng(%1);").arg(fmtLatLng(epts[epts.size()-1])) << QString("var idx = %1;").arg(num) @@ -210,7 +210,7 @@ void Map::showGpxData() scriptStr << "for( var i=0; ilogTimeX("Done defining JS string"); evaluateJS(scriptStr); this->logTimeX("Done JS evaluation"); @@ -261,11 +261,11 @@ void Map::showGpxData() //------------------------------------------------------------------------ void Map::markerClicked(int t, int i){ - if (t == 0) + if (t == 0) emit waypointClicked(i); - else if (t == 1) + else if (t == 1) emit trackClicked(i); - else if (t == 2) + else if (t == 2) emit routeClicked(i); } @@ -359,7 +359,7 @@ void Map::setTrackVisibility(int i, bool show) { QString x = show?"show": "hide"; QStringList scriptStr; - scriptStr + scriptStr << QString("trks[%1].%2();").arg(i).arg(x) ; evaluateJS(scriptStr); @@ -370,7 +370,7 @@ void Map::setRouteVisibility(int i, bool show) { QString x = show?"show": "hide"; QStringList scriptStr; - scriptStr + scriptStr << QString("rtes[%1].%2();").arg(i).arg(x) ; evaluateJS(scriptStr); @@ -386,7 +386,7 @@ void Map::panTo(const LatLng &loc) void Map::resizeEvent ( QResizeEvent * ev) { QWebView::resizeEvent(ev); - if (mapPresent) + if (mapPresent) evaluateJS(QString("map.checkResize();")); } @@ -427,7 +427,7 @@ void Map::frameRoute(int i) //------------------------------------------------------------------------ -void Map::evaluateJS(const QString &s, bool upd) +void Map::evaluateJS(const QString &s, bool upd) { this->page()->mainFrame()->evaluateJavaScript(s); if (upd) { @@ -436,7 +436,7 @@ void Map::evaluateJS(const QString &s, bool upd) } //------------------------------------------------------------------------ -void Map::evaluateJS(const QStringList &s, bool upd) +void Map::evaluateJS(const QStringList &s, bool upd) { evaluateJS(s.join("\n"), upd); } diff --git a/gui/optionsdlg.cpp b/gui/optionsdlg.cpp index 1eb7e4388..c6304040a 100644 --- a/gui/optionsdlg.cpp +++ b/gui/optionsdlg.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: optionsdlg.cpp,v 1.1 2009/07/05 21:14:56 robertl Exp $ +// $Id: optionsdlg.cpp,v 1.2 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -42,19 +42,19 @@ static void SetSizeStuff(QWidget *w) } //------------------------------------------------------------------------ -FileDlgManager::FileDlgManager(QObject*parent, +FileDlgManager::FileDlgManager(QObject*parent, QLineEdit *le, QToolButton *tb, bool isInFile): QObject(parent), le(le), tb(tb), isInFile(isInFile) { connect(tb, SIGNAL(clicked()), this, SLOT(buttonClicked())); } - + //------------------------------------------------------------------------ QVariant getOptionValue(QList opts, int k) { - if (opts[k].getValue().toString() != "") + if (opts[k].getValue().toString() != "") return opts[k].getValue(); - else + else return opts[k].getDefaultValue(); } @@ -68,12 +68,12 @@ void FileDlgManager::buttonClicked() QString str; if (isInFile) { str = QFileDialog::getOpenFileName(0, tr("Select input file"), - le->text(), + le->text(), "All Files (*.*)"); } else { str = QFileDialog::getSaveFileName(0, tr("Select output file"), - le->text(), + le->text(), "All Files (*.*)"); } if (str != "") @@ -98,11 +98,11 @@ OptionsDlg::OptionsDlg(QWidget*parent, const QString &fmtName, QListaddItem(horizontalSpacer); - + QWidget *w = 0; - switch (options[k].getType()) + switch (options[k].getType()) { - case FormatOption::OPTstring: + case FormatOption::OPTstring: { QLineEdit *lineEdit = new QLineEdit(this); SetSizeStuff(lineEdit); @@ -112,8 +112,8 @@ OptionsDlg::OptionsDlg(QWidget*parent, const QString &fmtName, QListaddLayout(horizontalLayout); } QPushButton *helpButton = new QPushButton(this); @@ -218,7 +218,7 @@ void OptionsDlg::acceptClicked() value = qMax(qMin(value, options[k].getMaxValue().toDouble()),options[k].getMinValue().toDouble()); options[k].setValue(QVariant(value)); } - else + else options[k].setValue(static_cast(fields[k])->text()); } } diff --git a/gui/processwait.cpp b/gui/processwait.cpp index dcfcbfb75..375c0549c 100644 --- a/gui/processwait.cpp +++ b/gui/processwait.cpp @@ -1,5 +1,5 @@ // -*- c++ -*- -// $Id: processwait.cpp,v 1.2 2009/07/20 02:30:02 robertl Exp $ +// $Id: processwait.cpp,v 1.3 2009/08/28 17:08:55 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -35,28 +35,28 @@ //------------------------------------------------------------------------ -QString ProcessWaitDialog::processErrorString( QProcess::ProcessError err) +QString ProcessWaitDialog::processErrorString( QProcess::ProcessError err) { switch (err) { - case QProcess::FailedToStart: - return QString(tr("Process failed to start")); + case QProcess::FailedToStart: + return QString(tr("Process failed to start")); break; - case QProcess::Crashed: + case QProcess::Crashed: return QString(tr("Process crashed")); break; case QProcess::Timedout: return QString(tr("Process timedout")); break; case QProcess::WriteError: - return QString(tr("Error while trying to write to process")); + return QString(tr("Error while trying to write to process")); break; case QProcess::ReadError: return QString(tr("Error while trying to read from process")); break; case QProcess::UnknownError: default: - return QString(tr("Unknown process error")); + return QString(tr("Unknown process error")); } return QString(""); } @@ -67,23 +67,23 @@ ProcessWaitDialog::ProcessWaitDialog(QWidget *parent, QProcess *process): this->resize(400, 220); this->setWindowTitle(QString(appName) + tr(" ... Process GPSBabel")); QVBoxLayout *layout = new QVBoxLayout(this); - + textEdit = new QPlainTextEdit(this); textEdit->setReadOnly(true); layout->addWidget(textEdit); - + progressBar = new QProgressBar(this); progressBar->setTextVisible(false); layout->addWidget(progressBar); - + buttonBox = new QDialogButtonBox(this); buttonBox->setOrientation(Qt::Horizontal); buttonBox->setStandardButtons(QDialogButtonBox::Abort); QPushButton* btn = buttonBox->button(QDialogButtonBox::Abort); btn->setText(tr("Stop Process")); layout->addWidget(buttonBox); - - connect(process, SIGNAL(error(QProcess::ProcessError)), + + connect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT (errorX(QProcess::ProcessError))); connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT (finishedX(int, QProcess::ExitStatus))); @@ -98,9 +98,9 @@ ProcessWaitDialog::ProcessWaitDialog(QWidget *parent, QProcess *process): bufferedOut = ""; // - for (int i=0; i<=100; i+=2) + for (int i=0; i<=100; i+=2) progressVals.push_back(i); - for (int i=98; i>0; i-=2) + for (int i=98; i>0; i-=2) progressVals.push_back(i); progressIndex = progressVals.size()/2; @@ -119,30 +119,30 @@ ProcessWaitDialog::~ProcessWaitDialog() { }; //------------------------------------------------------------------------ -bool ProcessWaitDialog::getExitedNormally() +bool ProcessWaitDialog::getExitedNormally() { return (errorString.length() == 0); }; //------------------------------------------------------------------------ -QString ProcessWaitDialog::getErrorString() +QString ProcessWaitDialog::getErrorString() { return errorString; }; //------------------------------------------------------------------------ -int ProcessWaitDialog::getExitCode() +int ProcessWaitDialog::getExitCode() { return ecode; }; //------------------------------------------------------------------------ -void ProcessWaitDialog::stopClickedX() +void ProcessWaitDialog::stopClickedX() { process->terminate(); }; //------------------------------------------------------------------------ -void ProcessWaitDialog::timeoutX() +void ProcessWaitDialog::timeoutX() { progressIndex++; int idx = progressIndex % progressVals.size(); @@ -166,7 +166,7 @@ void ProcessWaitDialog::errorX(QProcess::ProcessError err) }; //------------------------------------------------------------------------ -void ProcessWaitDialog::finishedX(int exitCode, QProcess::ExitStatus es) +void ProcessWaitDialog::finishedX(int exitCode, QProcess::ExitStatus es) { ecode = exitCode; if (es == QProcess::CrashExit) @@ -180,7 +180,7 @@ void ProcessWaitDialog::finishedX(int exitCode, QProcess::ExitStatus es) // appendPlainText automatically puts in a new line with every call. That's // why you have to buffer it, and only append when we get a real newline. // -void ProcessWaitDialog::appendToText(const char *ptr) +void ProcessWaitDialog::appendToText(const char *ptr) { outputString += QString(ptr); for (const char *cptr = ptr; *cptr; cptr++) { @@ -197,7 +197,7 @@ void ProcessWaitDialog::appendToText(const char *ptr) //------------------------------------------------------------------------ -void ProcessWaitDialog::readyReadStandardErrorX() +void ProcessWaitDialog::readyReadStandardErrorX() { QByteArray d = process->readAllStandardError(); appendToText(d.data()); diff --git a/gui/serial_mac.cpp b/gui/serial_mac.cpp index d20bd3d25..9c83bea27 100644 --- a/gui/serial_mac.cpp +++ b/gui/serial_mac.cpp @@ -81,7 +81,7 @@ static void CloseSerialPort(int fileDescriptor); // releasing the iterator when iteration is complete. static kern_return_t FindModems(io_iterator_t *matchingServices) { - kern_return_t kernResult; + kern_return_t kernResult; CFMutableDictionaryRef classesToMatch; /*! @function IOServiceMatching @@ -105,7 +105,7 @@ static kern_return_t FindModems(io_iterator_t *matchingServices) undefined. If the dictionary is a fixed-capacity dictionary and it is full before this operation, and the key does not exist in the dictionary, the behavior is undefined. - @param key The key of the value to set into the dictionary. If a key + @param key The key of the value to set into the dictionary. If a key which matches this key is already present in the dictionary, only the value is changed ("add if absent, replace if present"). If no key matches the given key, the key-value pair is added to the @@ -122,18 +122,18 @@ static kern_return_t FindModems(io_iterator_t *matchingServices) // CFDictionarySetValue(classesToMatch, // CFSTR(kIOSerialBSDTypeKey), // CFSTR(kIOSerialBSDModemType)); - + // Each serial device object has a property with key // kIOSerialBSDTypeKey and a value that is one of kIOSerialBSDAllTypes, // kIOSerialBSDModemType, or kIOSerialBSDRS232Type. You can experiment with the // matching by changing the last parameter in the above call to CFDictionarySetValue. - + // As shipped, this sample is only interested in modems, - // so add this property to the CFDictionary we're matching on. + // so add this property to the CFDictionary we're matching on. // This will find devices that advertise themselves as modems, // such as built-in and USB modems. However, this match won't find serial modems. } - + /*! @function IOServiceGetMatchingServices @abstract Look up registered IOService objects that match a matching dictionary. @discussion This is the preferred method of finding IOService objects currently registered by IOKit. IOServiceAddNotification can also supply this information and install a notification of new IOServices. The matching information used in the matching dictionary may vary depending on the class of service being looked up. @@ -142,17 +142,17 @@ static kern_return_t FindModems(io_iterator_t *matchingServices) @param existing An iterator handle is returned on success, and should be released by the caller when the iteration is finished. @result A kern_return_t error code. */ - kernResult = IOServiceGetMatchingServices(kIOMasterPortDefault, classesToMatch, matchingServices); + kernResult = IOServiceGetMatchingServices(kIOMasterPortDefault, classesToMatch, matchingServices); if (KERN_SUCCESS != kernResult) { printf("IOServiceGetMatchingServices returned %d\n", kernResult); goto exit; } - + exit: return kernResult; } - + // Given an iterator across a set of modems, return the BSD path to the first one. // If no modems are found the path name is set to an empty string. static kern_return_t GetModemPath(io_iterator_t serialPortIterator, char *bsdPath, CFIndex maxPathSize, QComboBox *box) @@ -160,12 +160,12 @@ static kern_return_t GetModemPath(io_iterator_t serialPortIterator, char *bsdPat io_object_t modemService; kern_return_t kernResult = KERN_FAILURE; Boolean modemFound = false; - + // Initialize the returned path *bsdPath = '\0'; - + // Iterate across all modems found. In this example, we bail after finding the first modem. - + while ((modemService = IOIteratorNext(serialPortIterator)) && !modemFound) { CFTypeRef bsdPathAsCFString; @@ -181,16 +181,16 @@ static kern_return_t GetModemPath(io_iterator_t serialPortIterator, char *bsdPat if (bsdPathAsCFString) { Boolean result; - + // Convert the path from a CFString to a C (NUL-terminated) string for use // with the POSIX open() call. - + result = CFStringGetCString((const __CFString*) bsdPathAsCFString, bsdPath, - maxPathSize, + maxPathSize, kCFStringEncodingUTF8); CFRelease(bsdPathAsCFString); - + if (result) { box->addItem(bsdPath); } @@ -202,7 +202,7 @@ static kern_return_t GetModemPath(io_iterator_t serialPortIterator, char *bsdPat // (void) IOObjectRelease(modemService); } - + return kernResult; } @@ -216,4 +216,4 @@ void MainWindow::osLoadDeviceNameCombos(QComboBox *box) kernResult = FindModems(&serialPortIterator); kernResult = GetModemPath(serialPortIterator, bsdPath, sizeof(bsdPath), box); -} +} diff --git a/gui/upgrade.cpp b/gui/upgrade.cpp index 4ab743fca..de5278cb2 100644 --- a/gui/upgrade.cpp +++ b/gui/upgrade.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: upgrade.cpp,v 1.9 2009/08/10 21:21:29 robertl Exp $ +// $Id: upgrade.cpp,v 1.10 2009/08/28 17:08:55 robertl Exp $ /* Copyright (C) 2009 Robert Lipe, robertlipe@gpsbabel.org @@ -210,7 +210,7 @@ void UpgradeCheck::httpRequestFinished(int requestId, bool error) information.setDefaultButton(QMessageBox::Yes); information.setText(response); - information.setInformativeText(tr("Do you wish do download an upgrade?")); + information.setInformativeText(tr("Do you wish to download an upgrade?")); information.setDetailedText(upgradeText); switch (information.exec()) { -- 2.30.2